import java.util.Arrays;

import static SortAlgorithm.SelectSort.swap;

public class QuickSort {
    public static void main(String[] args) {
        int[] a=new int[]{8 ,60, 67, 74, 48, 71, 5 ,22 ,85 ,55};
        System.out.println(Arrays.toString(a));
        quickSort(a,0,a.length-1);
        System.out.println(Arrays.toString(a));
    }
    public static void quickSort(int[] array,int L,int R){
        if(L>R)return;
        int left=L;
        int right=R;
        int pivot=array[L];
        while(left<=right){
            if(array[left]<=pivot){
                left++;
            }else{
                swap(array,left,right);
                right--;
            }
        }
        swap(array,L,right);
        quickSort(array,L,right-1);
        quickSort(array,right+1,R);
    }
}
